package com.sc.nft.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.DaoAccountBankInfo;
import com.sc.nft.mapper.DaoAccountBankInfoMapper;
import  com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

/**
 * (sc_dao_account_bank_info)数据DAO
 *
 * @author zxy
 * @since 2023-11-25 16:18:38
 * @description 商户banner
 */
@Slf4j
@Repository
public class DaoAccountBankInfoDao extends ServiceImpl<DaoAccountBankInfoMapper, DaoAccountBankInfo> {

    public void clearByAccountId(Long accountId){
        lambdaUpdate().eq(DaoAccountBankInfo::getDaoOpenAccountId,accountId).remove();
    }

    public DaoAccountBankInfo getByAccountId (Long accountId){
       return lambdaQuery().eq(DaoAccountBankInfo::getDaoOpenAccountId,accountId).last("limit 1").one();
    }
    public Page<DaoAccountBankInfo> getByDaoAndAccountId (Long accountId,Long daoId,Page page){
        return lambdaQuery().eq(DaoAccountBankInfo::getDaoId,daoId).eq(DaoAccountBankInfo::getDaoOpenAccountId,accountId).page(page);
    }


}